
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';

/// channel 通道名称
/// method  方法名称
/// arguments 传递的参数
class ChannelPlugin {

  final String channel;
  final String method;
  final dynamic arguments;
  const ChannelPlugin({@required this.channel, @required this.method, this.arguments});

  Future invokeMethod() async {
   var result;
    try {
      result = await MethodChannel(this.channel).invokeMethod(this.method,this.arguments);
      return Future.value(result);
    } on PlatformException catch (e) {
      return Future.error(e.toString());
    }
  }
}